Tutorial and Feature Showcase

In this demo, we present a basic demonstration of our project by training the qGAN to generate an $8 \times 8$ pixel art of smiley face. Enjoy :)

Import modules

First, import python modules as follows:

Second, import our custom qGAN image generator class in the imgen.py.

Load image

Now, initialze the input pixel art.

Initialize the qGAN class for image recognition.

Load the pixel art. After preprocessing with Gaussian filters, this is what your original art looks like!

qGAN training

Train the qGAN and see how the output of the generator changes in 300 epochs! (Spoiler alert: you can see your smiley face again after only ~30 epochs!)

Results

Generate an interactive animation that shows the probability distribution of the circuit output at each training epoch.

Plot loss function versus steps. A trend towards convergence can be seen.

Plot the probability distribution of the final circuit output (averaged across last 5 epochs). It matches pretty well with the original pixel face!

Get the final variational parameters (averaged across last 10 steps) for the circuit.